package org.mzyyn.qr.config;

import org.mzyyn.qr.constants.AppletsApiUrlMapping;
import org.mzyyn.qr.interceptor.AppletsInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {


    @Autowired
    private AppletsInterceptor appletsInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        //小程序接口拦截
        registry.addInterceptor(appletsInterceptor) //注册拦截器，
                .addPathPatterns(AppletsApiUrlMapping.BASE.concat("/**"))
        ;
    }
    private static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
    private static final String DATE_FORMAT = "yyyy-MM-dd";

}


